<!-- Created by henian.xu on 2018/11/9. -->

<template>
    <div class="date-picker">
        <DateP
            :language="zh"
            format="yyyy-MM-dd"
            v-model="model">sadf</DateP>
    </div>
</template>

<script>
import DateP from 'vuejs-datepicker';
import zh from './zh';
export default {
    name: 'DatePicker',
    components: { DateP },
    data() {
        return {
            zh,
        };
    },
    props: {
        value: {
            type: Number,
            default: null,
        },
    },
    computed: {
        model: {
            get() {
                return this.value;
            },
            set(val) {
                this.$emit('input', val.getTime());
            },
        },
    },
};
</script>

<style lang="scss">
@import '~/assets/style/_index.scss';
.date-picker {
    border: 1px solid $color-border;
    border-radius: 5px;
    padding: 0 $padding-small;
    input {
        width: 100%;
        line-height: 40px;
        background-color: transparent;
    }
}

.success {
    .date-picker {
        border-color: $color-success;
    }
}
.error {
    .date-picker {
        border-color: $color-danger;
    }
}
</style>
